package com.hxwb.chainmaker.rpc.dao;

import com.hxwb.chainmaker.rpc.controller.ChainmakerController;
import com.hxwb.chainmaker.rpc.entity.ChainmakerEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.List;

@Repository
public interface ChainmakerDao extends JpaRepository<ChainmakerEntity, Integer> {
    List<ChainmakerEntity> findAllByUsed(int used);

    ChainmakerEntity findByUuserId(String uuserId);

    @Query(value = "SELECT a.id FROM member a LEFT JOIN chainmaker b ON CONCAT('U',a.id) = b.uuser_id WHERE b.id IS NULL;",nativeQuery = true)
    List<BigInteger> findAllUserId();
}
